import { S } from '../../s';
import { IPSAppCodeList } from '../../app/codelist/ipsapp-code-list';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { PSMDAjaxControlContainerImpl } from '../psmdajax-control-container-impl';
import { IPSSysCalendar } from './ipssys-calendar';
import { IPSSysCalendarItem } from './ipssys-calendar-item';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';

export class PSSysCalendarImpl
  extends PSMDAjaxControlContainerImpl
  implements IPSSysCalendar
{
  get calendarStyle():
    | 'DAY'
    | 'WEEK'
    | 'MONTH'
    | 'TIMELINE'
    | 'WEEK_TIMELINE'
    | 'MONTH_TIMELINE'
    | 'USER'
    | 'USER2' {
    return this.M.calendarStyle;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes;
  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.emptytextpslanguageres ||
      (this.emptytextpslanguageres = this.fillObjectModel(
        S._276,
        this.M.getEmptyTextPSLanguageRes,
        S._2b4,
      ) as IPSLanguageRes)
    );
  }

  get groupHeight(): number {
    return this.M.groupHeight != null ? this.M.groupHeight : 0;
  }

  get groupLayout(): 'ROW' | 'COLUMN' {
    return this.M.groupLayout;
  }

  get groupMode(): 'NONE' | 'AUTO' | 'CODELIST' {
    return this.M.groupMode;
  }

  protected grouppsappdefield: IPSAppDEField;
  getGroupPSAppDEField(): IPSAppDEField | null {
    return (
      this.grouppsappdefield ||
      (this.grouppsappdefield = this.fillObjectModel(
        S._1,
        this.M.getGroupPSAppDEField,
        S._34c,
      ) as IPSAppDEField)
    );
  }

  protected grouppscodelist: IPSAppCodeList;
  getGroupPSCodeList(): IPSAppCodeList | null {
    return (
      this.grouppscodelist ||
      (this.grouppscodelist = this.fillObjectModel(
        S._8,
        this.M.getGroupPSCodeList,
        S._34d,
      ) as IPSAppCodeList)
    );
  }

  protected grouppssyscss: IPSSysCss;
  getGroupPSSysCss(): IPSSysCss | null {
    return (
      this.grouppssyscss ||
      (this.grouppssyscss = this.fillObjectModel(
        S._278,
        this.M.getGroupPSSysCss,
        S._34e,
      ) as IPSSysCss)
    );
  }

  protected grouppssyspfplugin: IPSSysPFPlugin;
  getGroupPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.grouppssyspfplugin ||
      (this.grouppssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getGroupPSSysPFPlugin,
        S._34f,
      ) as IPSSysPFPlugin)
    );
  }

  get groupWidth(): number {
    return this.M.groupWidth != null ? this.M.groupWidth : 0;
  }

  get legendPos(): 'LEFT' | 'TOP' | 'RIGHT' | 'BOTTOM' | 'NONE' {
    return this.M.legendPos;
  }

  protected pssyscalendaritems: IPSSysCalendarItem[];
  getPSSysCalendarItems(): IPSSysCalendarItem[] | null {
    return (
      this.pssyscalendaritems ||
      (this.pssyscalendaritems = this.fillChildListModel(
        this.M.getPSSysCalendarItems,
        S._118,
      ) as IPSSysCalendarItem[])
    );
  }

  findPSSysCalendarItem(objKey: any): IPSSysCalendarItem | null {
    return this.getPSModel5(
      S._118,
      this.getPSSysCalendarItems(),
      objKey,
    ) as IPSSysCalendarItem;
  }

  hasWFDataItems(): boolean {
    return this.M.hasWFDataItems;
  }

  get enableEdit(): boolean {
    return this.M.enableEdit != null ? this.M.enableEdit : false;
  }

  get enableGroup(): boolean {
    return this.M.enableGroup;
  }
  get cls(): string {
    return 'PSSysCalendarImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._247 || cls == S._248) return true;
    return super.instanceof(cls);
  }
}
